#ifndef FASTVEIWWIDGET_H
#define FASTVEIWWIDGET_H
//****************************************************************************************************************
// Filename: fasrviewwidget.h
// head file for pagespinbox class
// date March 2012
// this widget is use to display single a page 
// use in fast nav mode
//****************************************************************************************************************

#include <QLabel>
#include <QRectF>
#include <poppler-qt4.h>
#include <QtGui/QScrollArea>
#include <QScrollArea>
#include <QMouseEvent>
#include <QLineF>
#include <QPointF>

class FastViewWidget : public QScrollArea
{
    Q_OBJECT

public:
    FastViewWidget(QWidget *parent = 0);
    ~FastViewWidget();
    // functions to get testing data
    double getDistance();

    public slots:
    // slots to set a doc point
    bool setDocument(Poppler::Document *d);
    // set page
    void setPage(int page = -1);
    // colloect data
    void beginTest();
    void abortTest();

  protected:
    // function to handle mouse press event
    // if a middle key or right key pressed
    // send a signal
    void mousePressEvent (QMouseEvent *);

    // function to handle  double click 
    // if a double click happen
    // send a signal
    void mouseDoubleClickEvent (QMouseEvent *);
    // auto resize handle
    void resizeEvent ( QResizeEvent *);
    
  signals:
    //signals
    void pageChanged(int currentPage);
    void pageClicked(int currentPage);
    void midpressed();

private:
    void showPage(int page = -1);
    Poppler::Document *doc;
    int currentPage;
    qreal scaleFactor;
    QLabel *current;
    
    // following varibales are used for get testing data
    double travelDistance;
    bool startTest;
    QPointF last;
};

#endif
